package com.xiaohong.account.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaohong.account.pojo.AccountTbl;
import com.xiaohong.account.fallback.AccountFallback;
import entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@FeignClient(name="account-service",contextId = "accountTbl",fallback = AccountFallback.class)
//@FeignClient(name="account-service",contextId = "accountTbl")
public interface AccountTblFeign {

    /***
     * 分页条件搜索实现AccountTbl
     * @param accountTbl
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/accountTbl/search/{page}/{size}")
    Result<Page> findPage(@RequestBody(required = false) AccountTbl accountTbl, @PathVariable int page, @PathVariable int size);

    /***
     * 分页搜索实现AccountTbl
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/accountTbl/search/{page}/{size}")
    Result<Page> findPage(@PathVariable int page, @PathVariable int size);

    /***
     * 多条件搜索AccountTbl数据
     * @param accountTbl
     * @return
     */
    @PostMapping(value = "/accountTbl/search")
    Result<List<AccountTbl>>findList(@RequestBody(required = false) AccountTbl accountTbl);

    /***
     * 根据Id删除accountTbl数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/accountTbl/{id}")
    Result delete(@PathVariable Integer id);

    /***
     * 根据ID修改AccountTbl数据
     * @param accountTbl
     * @param id
     * @return
     */
    @PutMapping(value = "/accountTbl/{id}")
    Result update(@RequestBody AccountTbl accountTbl, @PathVariable Integer id);

    /***
     * 新增AccountTbl数据
     * @param accountTbl
     * @return
     */
    @PostMapping(value = "/accountTbl")
    Result add(@RequestBody AccountTbl accountTbl);

    /***
     * 根据ID查询AccountTbl数据
     * @param id
     * @return
     */
    @GetMapping("/accountTbl/{id}")
    Result<AccountTbl>findById(@PathVariable Integer id);

    /***
     * 查询AccountTbl全部数据
     * @return
     */
    @GetMapping(value = "/accountTbl")
    Result<List<AccountTbl>>findAll();

}
